import { Directive,HostListener } from '@angular/core';
import { NavController } from 'ionic-angular';


/***
 *  该指令的作用是 点击搜索图标 进入搜索界面 (多个界面使用 故做成指令）
 *  <button ion-button search-btn>
 */

@Directive({
  selector: 'button[search-btn]', // Attribute selector
})
export class SearchBtnDirective {

  constructor(public navCtrl: NavController) {
  }

  @HostListener('click', ['$event.target'])
  onClick(btn: HTMLElement) {
    this.navCtrl.push('SearchPage');
  }
}